summaryrefslogtreecommitdiff
path: root/svx/source/tbxctrls/fillctrl.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-05-05 16:51:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-05-05 17:21:58 +0100
commitf34a473ba96849e2e5277702a7b2bbef9398b6d4 (patch)
treed0dd72c151affedfbf03fcfed844e227f8482991 /svx/source/tbxctrls/fillctrl.cxx
parent8c73b6eeb87eeac3def69e0026e80d7d951e2592 (diff)
restore this utter madness
where we get the untranslated names for these for some weird and wonderful reason that escapes me, but this is clearly why this existed. Change-Id: Ic7a7897a4988a981a3a77a8e64521d1738a323ee
Diffstat (limited to 'svx/source/tbxctrls/fillctrl.cxx')
-rw-r--r--svx/source/tbxctrls/fillctrl.cxx100
1 files changed, 100 insertions, 0 deletions
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index 7ec5ff6611cb..e1e58e6ca59e 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -28,6 +28,9 @@
#include <vcl/toolbox.hxx>
#include <svx/dialogs.hrc>
+#define TMP_STR_BEGIN "["
+#define TMP_STR_END "]"
+
#include "svx/drawitem.hxx"
#include "svx/xattr.hxx"
#include <svx/xtable.hxx>
@@ -355,6 +358,39 @@ void SvxFillToolBoxControl::Update()
const OUString aString(mpFillGradientItem->GetName());
mpLbFillAttr->SelectEntry(aString);
+
+ // Check if the entry is not in the list
+ if (mpLbFillAttr->GetSelectEntry() != aString)
+ {
+ sal_Int32 nCount = mpLbFillAttr->GetEntryCount();
+ OUString aTmpStr;
+ if( nCount > 0 )
+ {
+ // Last entry gets tested against temporary entry
+ aTmpStr = mpLbFillAttr->GetEntry( nCount - 1 );
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
+ {
+ mpLbFillAttr->RemoveEntry(nCount - 1);
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
+
+ boost::scoped_ptr<XGradientEntry> pEntry(new XGradientEntry(mpFillGradientItem->GetGradientValue(), aTmpStr));
+ XGradientList aGradientList( "", ""/*TODO?*/ );
+ aGradientList.Insert( pEntry.get() );
+ aGradientList.SetDirty( false );
+ const Bitmap aBmp = aGradientList.GetUiBitmap( 0 );
+
+ if(!aBmp.IsEmpty())
+ {
+ mpLbFillAttr->InsertEntry(pEntry->GetName(), Image(aBmp));
+ mpLbFillAttr->SelectEntryPos(mpLbFillAttr->GetEntryCount() - 1);
+ }
+
+ aGradientList.Remove( 0 );
+ }
+
}
else
{
@@ -384,6 +420,40 @@ void SvxFillToolBoxControl::Update()
const OUString aString(mpHatchItem->GetName());
mpLbFillAttr->SelectEntry( aString );
+
+ // Check if the entry is not in the list
+ if( mpLbFillAttr->GetSelectEntry() != aString )
+ {
+ sal_uInt16 nCount = mpLbFillAttr->GetEntryCount();
+ OUString aTmpStr;
+ if( nCount > 0 )
+ {
+ // Last entry gets tested against temporary entry
+ aTmpStr = mpLbFillAttr->GetEntry( nCount - 1 );
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
+ {
+ mpLbFillAttr->RemoveEntry( nCount - 1 );
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
+
+ XHatchEntry* pEntry = new XHatchEntry(mpHatchItem->GetHatchValue(), aTmpStr);
+ XHatchList aHatchList( "", ""/*TODO?*/ );
+ aHatchList.Insert( pEntry );
+ aHatchList.SetDirty( sal_False );
+ const Bitmap aBmp = aHatchList.GetUiBitmap( 0 );
+
+ if( !aBmp.IsEmpty() )
+ {
+ mpLbFillAttr->InsertEntry(pEntry->GetName(), Image(aBmp));
+ mpLbFillAttr->SelectEntryPos( mpLbFillAttr->GetEntryCount() - 1 );
+ //delete pBmp;
+ }
+
+ aHatchList.Remove( 0 );
+ delete pEntry;
+ }
}
else
{
@@ -413,6 +483,36 @@ void SvxFillToolBoxControl::Update()
const OUString aString(mpBitmapItem->GetName());
mpLbFillAttr->SelectEntry(aString);
+
+ // Check if the entry is not in the list
+ if (mpLbFillAttr->GetSelectEntry() != aString)
+ {
+ sal_Int32 nCount = mpLbFillAttr->GetEntryCount();
+ OUString aTmpStr;
+ if( nCount > 0 )
+ {
+ // Last entry gets tested against temporary entry
+ aTmpStr = mpLbFillAttr->GetEntry(nCount - 1);
+ if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+ aTmpStr.endsWith(TMP_STR_END) )
+ {
+ mpLbFillAttr->RemoveEntry(nCount - 1);
+ }
+ }
+ aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
+
+ boost::scoped_ptr<XBitmapEntry> pEntry(new XBitmapEntry(mpBitmapItem->GetGraphicObject(), aTmpStr));
+ XBitmapListRef xBitmapList =
+ XPropertyList::AsBitmapList(
+ XPropertyList::CreatePropertyList(
+ XBITMAP_LIST, "TmpList", ""/*TODO?*/));
+ xBitmapList->Insert( pEntry.get() );
+ xBitmapList->SetDirty( false );
+ mpLbFillAttr->Fill( xBitmapList );
+ mpLbFillAttr->SelectEntryPos(mpLbFillAttr->GetEntryCount() - 1);
+ xBitmapList->Remove( 0 );
+ }
+
}
else
{