summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSzabolcs Dezsi <dezsiszabi@hotmail.com>2012-03-15 15:23:17 +0100
committerAndras Timar <atimar@suse.com>2012-03-17 15:26:41 +0100
commit1f26de8f2438170db504f67b82544965b9869c5e (patch)
tree36502c48074ef359e8e6721031233fb99c26e90e /sc
parentc39e96d984b5907f8e0c0247828c8e35f2e9ce72 (diff)
i#84393 Fix title field in header, footer
According to help Title should be the Title property of the document, not the file name without extension. If that property is missing, we fall back to file name without extension. Signed-off-by: Andras Timar <atimar@suse.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/view/prevwsh.cxx7
-rw-r--r--sc/source/ui/view/printfun.cxx7
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx8
3 files changed, 19 insertions, 3 deletions
diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index ef995ba5e29d..12ae9d1ecda2 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -75,6 +75,7 @@
#include <svx/dialogs.hrc>
#include <svx/zoom_def.hxx>
+#include <com/sun/star/document/XDocumentProperties.hpp>
#include "sc.hrc"
#include "scabstdlg.hxx"
@@ -840,7 +841,11 @@ void ScPreviewShell::FillFieldData( ScHeaderFieldData& rData )
pDoc->GetName(nTab, aTmp);
rData.aTabName = aTmp;
- rData.aTitle = pDocShell->GetTitle();
+ if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
+ rData.aTitle = pDocShell->getDocProperties()->getTitle();
+ else
+ rData.aTitle = pDocShell->GetTitle();
+
const INetURLObject& rURLObj = pDocShell->GetMedium()->GetURLObject();
rData.aLongDocName = rURLObj.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
if ( rData.aLongDocName.Len() )
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index e6484ceec031..73583b4f05ca 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -83,6 +83,7 @@
#include <vcl/lineinfo.hxx>
#include <boost/scoped_ptr.hpp>
+#include <com/sun/star/document/XDocumentProperties.hpp>
#define ZOOM_MIN 10
@@ -1037,7 +1038,11 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions )
SetDateTime( Date( Date::SYSTEM ), Time( Time::SYSTEM ) );
- aFieldData.aTitle = pDocShell->GetTitle();
+ if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
+ aFieldData.aTitle = pDocShell->getDocProperties()->getTitle();
+ else
+ aFieldData.aTitle = pDocShell->GetTitle();
+
const INetURLObject& rURLObj = pDocShell->GetMedium()->GetURLObject();
aFieldData.aLongDocName = rURLObj.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
if ( aFieldData.aLongDocName.Len() )
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index f8e2ab84d788..ffb64a3aac7b 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -97,6 +97,8 @@
#include "markdata.hxx"
#include "preview.hxx"
+#include <com/sun/star/document/XDocumentProperties.hpp>
+
void ActivateOlk( ScViewData* pViewData );
void DeActivateOlk( ScViewData* pViewData );
@@ -1824,7 +1826,11 @@ void ScTabViewShell::FillFieldData( ScHeaderFieldData& rData )
pDoc->GetName(nTab, aTmp);
rData.aTabName = aTmp;
- rData.aTitle = pDocShell->GetTitle();
+ if( pDocShell->getDocProperties()->getTitle().getLength() != 0 )
+ rData.aTitle = pDocShell->getDocProperties()->getTitle();
+ else
+ rData.aTitle = pDocShell->GetTitle();
+
const INetURLObject& rURLObj = pDocShell->GetMedium()->GetURLObject();
rData.aLongDocName = rURLObj.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS );
if ( rData.aLongDocName.Len() )