[Libreoffice-commits] core.git: sw/inc sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Nov 8 09:30:20 UTC 2018
sw/inc/view.hxx | 31 +++++++++++++++
sw/source/ui/frmdlg/cption.cxx | 18 ++++++--
sw/source/uibase/inc/initui.hxx | 9 ----
sw/source/uibase/uiview/view2.cxx | 41 ++++++++++++++++++++
sw/source/uibase/utlui/initui.cxx | 77 +-------------------------------------
5 files changed, 88 insertions(+), 88 deletions(-)
New commits:
commit c399d0715f6d3fe16896af8d1f85e66855e17402
Author: Nickson <nicksonthanda10 at msn.com>
AuthorDate: Thu Sep 20 02:19:24 2018 +0100
Commit: Heiko Tietze <tietze.heiko at gmail.com>
CommitDate: Thu Nov 8 10:28:34 2018 +0100
tdf#119738 - Set default image caption to illustration if already being used
Change-Id: I8371bd4184734857a6c5578dc5c235760f83cc36
Reviewed-on: https://gerrit.libreoffice.org/60787
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index ae3db0670892..b5c29997fd22 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -644,6 +644,37 @@ public:
/// See SfxViewShell::NotifyCursor().
void NotifyCursor(SfxViewShell* pViewShell) const override;
void ShowUIElement(const OUString& sElementURL) const;
+
+
+ enum CachedStringID
+ {
+ OldGrfCat,
+ OldTabCat,
+ OldFrameCat,
+ OldDrwCat,
+ CachedStrings
+ };
+
+ OUString m_StringCache[CachedStrings];
+
+ const OUString& GetCachedString(CachedStringID id)
+ {
+ return m_StringCache[id];
+ }
+
+ void SetCachedString(CachedStringID id, const OUString& sStr)
+ {
+ m_StringCache[id] = sStr;
+ }
+
+ const OUString& GetOldGrfCat();
+ void SetOldGrfCat(const OUString& sStr);
+ const OUString& GetOldTabCat();
+ void SetOldTabCat(const OUString& sStr);
+ const OUString& GetOldFrameCat();
+ void SetOldFrameCat(const OUString& sStr);
+ const OUString& GetOldDrwCat();
+ void SetOldDrwCat(const OUString& sStr);
};
inline long SwView::GetXScroll() const
diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx
index 2b96b74ad99b..3f650c189003 100644
--- a/sw/source/ui/frmdlg/cption.cxx
+++ b/sw/source/ui/frmdlg/cption.cxx
@@ -161,7 +161,15 @@ SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) :
if (eType & SelectionType::Graphic)
{
nPoolId = RES_POOLCOLL_LABEL_FIGURE;
- sString = ::GetOldGrfCat();
+
+ SwSetExpFieldType* pTypeIll= static_cast<SwSetExpFieldType*>(rSh.GetFieldType(SwFieldIds::SetExp, SwResId(STR_POOLCOLL_LABEL_ABB)));
+ if(rSh.IsUsed(*pTypeIll)) //default to illustration for legacy docs
+ {
+ nPoolId = RES_POOLCOLL_LABEL_ABB;
+
+ }
+
+ sString = rView.GetOldGrfCat();
bCopyAttributes = true;
//if not OLE
if(!xNameAccess.is())
@@ -174,26 +182,26 @@ SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) :
else if( eType & SelectionType::Table )
{
nPoolId = RES_POOLCOLL_LABEL_TABLE;
- sString = ::GetOldTabCat();
+ sString = rView.GetOldTabCat();
uno::Reference< text::XTextTablesSupplier > xTables(xModel, uno::UNO_QUERY);
xNameAccess = xTables->getTextTables();
}
else if( eType & SelectionType::Frame )
{
nPoolId = RES_POOLCOLL_LABEL_FRAME;
- sString = ::GetOldFrameCat();
+ sString = rView.GetOldFrameCat();
uno::Reference< text::XTextFramesSupplier > xFrames(xModel, uno::UNO_QUERY);
xNameAccess = xFrames->getTextFrames();
}
else if( eType == SelectionType::Text )
{
nPoolId = RES_POOLCOLL_LABEL_FRAME;
- sString = ::GetOldFrameCat();
+ sString = rView.GetOldFrameCat();
}
else if( eType & SelectionType::DrawObject )
{
nPoolId = RES_POOLCOLL_LABEL_DRAWING;
- sString = ::GetOldDrwCat();
+ sString = rView.GetOldDrwCat();
}
if( nPoolId )
{
diff --git a/sw/source/uibase/inc/initui.hxx b/sw/source/uibase/inc/initui.hxx
index 246f7d274a29..2cb010fd5c45 100644
--- a/sw/source/uibase/inc/initui.hxx
+++ b/sw/source/uibase/inc/initui.hxx
@@ -35,15 +35,6 @@ class SwThesaurus;
*/
extern SwThesaurus* pThes;
-SW_DLLPUBLIC const OUString& GetOldGrfCat();
-SW_DLLPUBLIC void SetOldGrfCat(const OUString& sStr);
-SW_DLLPUBLIC const OUString& GetOldTabCat();
-SW_DLLPUBLIC void SetOldTabCat(const OUString& sStr);
-SW_DLLPUBLIC const OUString& GetOldFrameCat();
-SW_DLLPUBLIC void SetOldFrameCat(const OUString& sStr);
-SW_DLLPUBLIC const OUString& GetOldDrwCat();
-SW_DLLPUBLIC void SetOldDrwCat(const OUString& sStr);
-
SW_DLLPUBLIC const OUString& GetCurrGlosGroup();
SW_DLLPUBLIC void SetCurrGlosGroup(const OUString& sStr);
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 15964603fedd..6e2801310134 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -2463,4 +2463,45 @@ void SwView::ExecuteScan( SfxRequest& rReq )
m_pViewImpl->ExecuteScan(rReq) ;
}
+const OUString& SwView::GetOldGrfCat()
+{
+ return GetCachedString(OldGrfCat);
+}
+
+void SwView::SetOldGrfCat(const OUString& sStr)
+{
+ SetCachedString(OldGrfCat, sStr);
+}
+
+const OUString& SwView::GetOldTabCat()
+{
+ return GetCachedString(OldTabCat);
+}
+
+void SwView::SetOldTabCat(const OUString& sStr)
+{
+ SetCachedString(OldTabCat, sStr);
+}
+
+const OUString& SwView::GetOldFrameCat()
+{
+ return GetCachedString(OldFrameCat);
+}
+
+void SwView::SetOldFrameCat(const OUString& sStr)
+{
+ SetCachedString(OldFrameCat, sStr);
+}
+
+const OUString& SwView::GetOldDrwCat()
+{
+ return GetCachedString(OldDrwCat);
+}
+
+void SwView::SetOldDrwCat(const OUString& sStr)
+{
+ SwView::SetCachedString(OldDrwCat, sStr);
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/utlui/initui.cxx b/sw/source/uibase/utlui/initui.cxx
index 2b8d43bd7a5b..b7a7364cfd8d 100644
--- a/sw/source/uibase/utlui/initui.cxx
+++ b/sw/source/uibase/utlui/initui.cxx
@@ -45,87 +45,17 @@ static SwGlossaryList* pGlossaryList = nullptr;
namespace
{
-
-enum CachedStringID
-{
- OldGrfCat,
- OldTabCat,
- OldFrameCat,
- OldDrwCat,
- CurrGlosGroup,
- CachedStrings
-};
-
-OUString StringCache[CachedStrings];
-
-const OUString& GetCachedString(CachedStringID id)
-{
- return StringCache[id];
-}
-
-void SetCachedString(CachedStringID id, const OUString& sStr)
-{
- StringCache[id] = sStr;
-}
-
-void ClearStringCache()
-{
- for (auto & s : StringCache)
- {
- s.clear();
- }
-}
-
-}
-
-const OUString& GetOldGrfCat()
-{
- return GetCachedString(OldGrfCat);
-}
-
-void SetOldGrfCat(const OUString& sStr)
-{
- SetCachedString(OldGrfCat, sStr);
-}
-
-const OUString& GetOldTabCat()
-{
- return GetCachedString(OldTabCat);
-}
-
-void SetOldTabCat(const OUString& sStr)
-{
- SetCachedString(OldTabCat, sStr);
-}
-
-const OUString& GetOldFrameCat()
-{
- return GetCachedString(OldFrameCat);
-}
-
-void SetOldFrameCat(const OUString& sStr)
-{
- SetCachedString(OldFrameCat, sStr);
-}
-
-const OUString& GetOldDrwCat()
-{
- return GetCachedString(OldDrwCat);
-}
-
-void SetOldDrwCat(const OUString& sStr)
-{
- SetCachedString(OldDrwCat, sStr);
+OUString CurrGlosGroup;
}
const OUString& GetCurrGlosGroup()
{
- return GetCachedString(CurrGlosGroup);
+ return CurrGlosGroup;
}
void SetCurrGlosGroup(const OUString& sStr)
{
- SetCachedString(CurrGlosGroup, sStr);
+ CurrGlosGroup = sStr;
}
namespace
@@ -149,7 +79,6 @@ void FinitUI()
delete SwFieldType::s_pFieldNames;
- ClearStringCache();
delete pGlossaryList;
delete pAuthFieldNameList;
delete pAuthFieldTypeList;
More information about the Libreoffice-commits
mailing list