1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include "condformatdlg.hxx"
11 #include "condformatdlg.hrc"
13 #include <vcl/vclevent.hxx>
14 #include <svl/style.hxx>
15 #include <sfx2/dispatch.hxx>
16 #include <svl/stritem.hxx>
17 #include <svl/intitem.hxx>
18 #include <svx/xtable.hxx>
19 #include <svx/drawitem.hxx>
20 #include <vcl/msgbox.hxx>
21 #include <vcl/settings.hxx>
22 #include <vcl/builderfactory.hxx>
23 #include <libxml/tree.h>
25 #include "anyrefdg.hxx"
26 #include "document.hxx"
27 #include "conditio.hxx"
28 #include "stlpool.hxx"
29 #include "tabvwsh.hxx"
30 #include "colorscale.hxx"
31 #include "colorformat.hxx"
32 #include "reffact.hxx"
34 #include "docfunc.hxx"
35 #include "condformatdlgentry.hxx"
37 #include "globstr.hrc"
39 ScCondFormatList::ScCondFormatList(vcl::Window
* pParent
, WinBits nStyle
)
40 : Control(pParent
, nStyle
| WB_DIALOGCONTROL
)
41 , mbHasScrollBar(false)
42 , mpScrollBar(VclPtr
<ScrollBar
>::Create(this, WB_VERT
))
44 , mpDialogParent(NULL
)
46 mpScrollBar
->SetScrollHdl( LINK( this, ScCondFormatList
, ScrollHdl
) );
47 mpScrollBar
->EnableDrag();
48 SetControlBackground( GetSettings().GetStyleSettings().GetWindowColor() );
49 SetBackground(GetControlBackground());
52 ScCondFormatList::~ScCondFormatList()
57 void ScCondFormatList::dispose()
59 mpDialogParent
.clear();
60 mpScrollBar
.disposeAndClear();
61 for (auto it
= maEntries
.begin(); it
!= maEntries
.end(); ++it
)
62 it
->disposeAndClear();
67 void ScCondFormatList::init(ScDocument
* pDoc
, ScCondFormatDlg
* pDialogParent
,
68 const ScConditionalFormat
* pFormat
, const ScRangeList
& rRanges
,
69 const ScAddress
& rPos
, condformat::dialog::ScCondFormatDialogType eType
)
71 mpDialogParent
= pDialogParent
;
78 size_t nCount
= pFormat
->size();
79 for (size_t nIndex
= 0; nIndex
< nCount
; ++nIndex
)
81 const ScFormatEntry
* pEntry
= pFormat
->GetEntry(nIndex
);
82 switch(pEntry
->GetType())
84 case condformat::CONDITION
:
86 const ScCondFormatEntry
* pConditionEntry
= static_cast<const ScCondFormatEntry
*>( pEntry
);
87 if(pConditionEntry
->GetOperation() != SC_COND_DIRECT
)
88 maEntries
.push_back(VclPtr
<ScConditionFrmtEntry
>::Create( this, mpDoc
, pDialogParent
, maPos
, pConditionEntry
) );
90 maEntries
.push_back(VclPtr
<ScFormulaFrmtEntry
>::Create( this, mpDoc
, pDialogParent
, maPos
, pConditionEntry
) );
94 case condformat::COLORSCALE
:
96 const ScColorScaleFormat
* pColorScale
= static_cast<const ScColorScaleFormat
*>( pEntry
);
97 if( pColorScale
->size() == 2 )
98 maEntries
.push_back(VclPtr
<ScColorScale2FrmtEntry
>::Create( this, mpDoc
, maPos
, pColorScale
) );
100 maEntries
.push_back(VclPtr
<ScColorScale3FrmtEntry
>::Create( this, mpDoc
, maPos
, pColorScale
) );
103 case condformat::DATABAR
:
104 maEntries
.push_back(VclPtr
<ScDataBarFrmtEntry
>::Create( this, mpDoc
, maPos
, static_cast<const ScDataBarFormat
*>( pEntry
) ) );
106 case condformat::ICONSET
:
107 maEntries
.push_back(VclPtr
<ScIconSetFrmtEntry
>::Create( this, mpDoc
, maPos
, static_cast<const ScIconSetFormat
*>( pEntry
) ) );
109 case condformat::DATE
:
110 maEntries
.push_back(VclPtr
<ScDateFrmtEntry
>::Create( this, mpDoc
, static_cast<const ScCondDateFormatEntry
*>( pEntry
) ) );
115 EntrySelectHdl(maEntries
[0].get());
121 case condformat::dialog::CONDITION
:
122 maEntries
.push_back(VclPtr
<ScConditionFrmtEntry
>::Create( this, mpDoc
, pDialogParent
, maPos
));
124 case condformat::dialog::COLORSCALE
:
125 maEntries
.push_back(VclPtr
<ScColorScale3FrmtEntry
>::Create( this, mpDoc
, maPos
));
127 case condformat::dialog::DATABAR
:
128 maEntries
.push_back(VclPtr
<ScDataBarFrmtEntry
>::Create( this, mpDoc
, maPos
));
130 case condformat::dialog::ICONSET
:
131 maEntries
.push_back(VclPtr
<ScIconSetFrmtEntry
>::Create( this, mpDoc
, maPos
));
133 case condformat::dialog::DATE
:
134 maEntries
.push_back(VclPtr
<ScDateFrmtEntry
>::Create( this, mpDoc
));
136 case condformat::dialog::NONE
:
141 if (!maEntries
.empty())
142 (*maEntries
.begin())->SetActive();
147 VCL_BUILDER_DECL_FACTORY(ScCondFormatList
)
149 WinBits nWinBits
= 0;
151 OString sBorder
= VclBuilder::extractCustomProperty(rMap
);
152 if (!sBorder
.isEmpty())
153 nWinBits
|= WB_BORDER
;
155 rRet
= VclPtr
<ScCondFormatList
>::Create(pParent
, nWinBits
);
158 Size
ScCondFormatList::GetOptimalSize() const
160 return LogicToPixel(Size(290, 185), MAP_APPFONT
);
163 void ScCondFormatList::Resize()
169 ScConditionalFormat
* ScCondFormatList::GetConditionalFormat() const
171 if(maEntries
.empty())
174 ScConditionalFormat
* pFormat
= new ScConditionalFormat(0, mpDoc
);
175 for(EntryContainer::const_iterator itr
= maEntries
.begin(); itr
!= maEntries
.end(); ++itr
)
177 ScFormatEntry
* pEntry
= (*itr
)->GetEntry();
179 pFormat
->AddEntry(pEntry
);
182 pFormat
->SetRange(maRanges
);
187 void ScCondFormatList::RecalcAll()
189 sal_Int32 nTotalHeight
= 0;
190 sal_Int32 nIndex
= 1;
191 for(EntryContainer::iterator itr
= maEntries
.begin(); itr
!= maEntries
.end(); ++itr
)
193 nTotalHeight
+= (*itr
)->GetSizePixel().Height();
194 (*itr
)->SetIndex( nIndex
);
198 Size aCtrlSize
= GetOutputSize();
199 long nSrcBarSize
= GetSettings().GetStyleSettings().GetScrollBarSize();
200 if(nTotalHeight
> GetSizePixel().Height())
202 mbHasScrollBar
= true;
203 mpScrollBar
->SetPosSizePixel(Point(aCtrlSize
.Width() -nSrcBarSize
, 0),
204 Size(nSrcBarSize
, aCtrlSize
.Height()) );
205 mpScrollBar
->SetRangeMax(nTotalHeight
);
206 mpScrollBar
->SetVisibleSize(aCtrlSize
.Height());
211 mbHasScrollBar
= false;
215 Point
aPoint(0,-1*mpScrollBar
->GetThumbPos());
216 for(EntryContainer::iterator itr
= maEntries
.begin(); itr
!= maEntries
.end(); ++itr
)
218 (*itr
)->SetPosPixel(aPoint
);
219 Size aSize
= (*itr
)->GetSizePixel();
221 aSize
.Width() = aCtrlSize
.Width() - nSrcBarSize
;
223 aSize
.Width() = aCtrlSize
.Width();
224 (*itr
)->SetSizePixel(aSize
);
226 aPoint
.Y() += (*itr
)->GetSizePixel().Height();
230 void ScCondFormatList::DoScroll(long nDelta
)
232 Point aNewPoint
= mpScrollBar
->GetPosPixel();
233 Rectangle
aRect(Point(), GetOutputSize());
234 aRect
.Right() -= mpScrollBar
->GetSizePixel().Width();
235 Scroll( 0, -nDelta
, aRect
);
236 mpScrollBar
->SetPosPixel(aNewPoint
);
239 IMPL_LINK(ScCondFormatList
, ColFormatTypeHdl
, ListBox
*, pBox
)
241 EntryContainer::iterator itr
= maEntries
.begin();
242 for(; itr
!= maEntries
.end(); ++itr
)
244 if((*itr
)->IsSelected())
247 if(itr
== maEntries
.end())
250 sal_Int32 nPos
= pBox
->GetSelectEntryPos();
254 if((*itr
)->GetType() == condformat::entry::COLORSCALE2
)
257 itr
->disposeAndClear();
258 *itr
= VclPtr
<ScColorScale2FrmtEntry
>::Create( this, mpDoc
, maPos
);
261 if((*itr
)->GetType() == condformat::entry::COLORSCALE3
)
264 itr
->disposeAndClear();
265 *itr
= VclPtr
<ScColorScale3FrmtEntry
>::Create( this, mpDoc
, maPos
);
268 if((*itr
)->GetType() == condformat::entry::DATABAR
)
271 itr
->disposeAndClear();
272 *itr
= VclPtr
<ScDataBarFrmtEntry
>::Create( this, mpDoc
, maPos
);
275 if((*itr
)->GetType() == condformat::entry::ICONSET
)
278 itr
->disposeAndClear();
279 *itr
= VclPtr
<ScIconSetFrmtEntry
>::Create( this, mpDoc
, maPos
);
284 mpDialogParent
->InvalidateRefData();
290 IMPL_LINK(ScCondFormatList
, TypeListHdl
, ListBox
*, pBox
)
292 //Resolves: fdo#79021 At this point we are still inside the ListBox Select.
293 //If we call maEntries.replace here then the pBox will be deleted before it
294 //has finished Select and will crash on accessing its deleted this. So Post
295 //to do the real work after the Select has completed
296 Application::PostUserEvent(LINK(this, ScCondFormatList
, AfterTypeListHdl
), pBox
, true);
300 IMPL_LINK(ScCondFormatList
, AfterTypeListHdl
, ListBox
*, pBox
)
302 EntryContainer::iterator itr
= maEntries
.begin();
303 for(; itr
!= maEntries
.end(); ++itr
)
305 if((*itr
)->IsSelected())
308 if(itr
== maEntries
.end())
311 sal_Int32 nPos
= pBox
->GetSelectEntryPos();
315 switch((*itr
)->GetType())
317 case condformat::entry::FORMULA
:
318 case condformat::entry::CONDITION
:
319 case condformat::entry::DATE
:
321 case condformat::entry::COLORSCALE2
:
322 case condformat::entry::COLORSCALE3
:
323 case condformat::entry::DATABAR
:
324 case condformat::entry::ICONSET
:
327 itr
->disposeAndClear();
328 *itr
= VclPtr
<ScColorScale3FrmtEntry
>::Create(this, mpDoc
, maPos
);
329 mpDialogParent
->InvalidateRefData();
333 if((*itr
)->GetType() == condformat::entry::CONDITION
)
336 itr
->disposeAndClear();
337 *itr
= VclPtr
<ScConditionFrmtEntry
>::Create(this, mpDoc
, mpDialogParent
, maPos
);
338 mpDialogParent
->InvalidateRefData();
342 if((*itr
)->GetType() == condformat::entry::FORMULA
)
345 itr
->disposeAndClear();
346 *itr
= VclPtr
<ScFormulaFrmtEntry
>::Create(this, mpDoc
, mpDialogParent
, maPos
);
347 mpDialogParent
->InvalidateRefData();
351 if((*itr
)->GetType() == condformat::entry::DATE
)
354 itr
->disposeAndClear();
355 *itr
= VclPtr
<ScDateFrmtEntry
>::Create( this, mpDoc
);
356 mpDialogParent
->InvalidateRefData();
365 IMPL_LINK_NOARG( ScCondFormatList
, AddBtnHdl
)
367 VclPtr
<ScCondFrmtEntry
> pNewEntry
= VclPtr
<ScConditionFrmtEntry
>::Create(this, mpDoc
, mpDialogParent
, maPos
);
368 maEntries
.push_back( pNewEntry
);
369 for(EntryContainer::iterator itr
= maEntries
.begin(); itr
!= maEntries
.end(); ++itr
)
371 (*itr
)->SetInactive();
373 mpDialogParent
->InvalidateRefData();
374 pNewEntry
->SetActive();
379 IMPL_LINK_NOARG( ScCondFormatList
, RemoveBtnHdl
)
381 for(EntryContainer::iterator itr
= maEntries
.begin(); itr
!= maEntries
.end(); ++itr
)
383 if((*itr
)->IsSelected())
385 itr
->disposeAndClear();
386 maEntries
.erase(itr
);
390 mpDialogParent
->InvalidateRefData();
395 IMPL_LINK( ScCondFormatList
, EntrySelectHdl
, ScCondFrmtEntry
*, pEntry
)
397 if(pEntry
->IsSelected())
400 //A child has focus, but we will hide that, so regrab to whatever new thing gets
401 //shown instead of leaving it stuck in the inaccessible hidden element
402 bool bReGrabFocus
= HasChildPathFocus();
403 for(EntryContainer::iterator itr
= maEntries
.begin(); itr
!= maEntries
.end(); ++itr
)
405 (*itr
)->SetInactive();
407 mpDialogParent
->InvalidateRefData();
415 IMPL_LINK_NOARG( ScCondFormatList
, ScrollHdl
)
417 DoScroll(mpScrollBar
->GetDelta());
421 // -------------------------------------------------------------------
422 // Conditional Format Dialog
424 ScCondFormatDlg::ScCondFormatDlg(SfxBindings
* pB
, SfxChildWindow
* pCW
,
425 vcl::Window
* pParent
, ScViewData
* pViewData
,
426 const ScConditionalFormat
* pFormat
, const ScRangeList
& rRange
,
427 const ScAddress
& rPos
, condformat::dialog::ScCondFormatDialogType eType
,
429 : ScAnyRefDlg(pB
, pCW
, pParent
, "ConditionalFormatDialog",
430 "modules/scalc/ui/conditionalformatdialog.ui")
431 , mbManaged(bManaged
)
433 , mpViewData(pViewData
)
437 get(mpBtnAdd
, "add");
438 get(mpBtnRemove
, "delete");
439 get(mpBtnCancel
, "cancel");
441 get(mpFtRange
, "ftassign");
442 get(mpEdRange
, "edassign");
443 mpEdRange
->SetReferences(this, mpFtRange
);
445 get(mpRbRange
, "rbassign");
446 mpRbRange
->SetReferences(this, mpEdRange
);
448 maKey
= pFormat
? pFormat
->GetKey() : 0;
450 get(mpCondFormList
, "list");
451 mpCondFormList
->init(mpViewData
->GetDocument(), this, pFormat
, rRange
, rPos
, eType
);
453 OUStringBuffer
aTitle( GetText() );
455 OUString aRangeString
;
456 rRange
.Format(aRangeString
, SCA_VALID
, pViewData
->GetDocument(),
457 pViewData
->GetDocument()->GetAddressConvention());
458 aTitle
.append(aRangeString
);
459 SetText(aTitle
.makeStringAndClear());
460 mpBtnOk
->SetClickHdl(LINK(this, ScCondFormatDlg
, BtnPressedHdl
) );
461 mpBtnAdd
->SetClickHdl( LINK( mpCondFormList
, ScCondFormatList
, AddBtnHdl
) );
462 mpBtnRemove
->SetClickHdl( LINK( mpCondFormList
, ScCondFormatList
, RemoveBtnHdl
) );
463 mpBtnCancel
->SetClickHdl( LINK(this, ScCondFormatDlg
, BtnPressedHdl
) );
464 mpEdRange
->SetModifyHdl( LINK( this, ScCondFormatDlg
, EdRangeModifyHdl
) );
465 mpEdRange
->SetGetFocusHdl( LINK( this, ScCondFormatDlg
, RangeGetFocusHdl
) );
466 mpEdRange
->SetLoseFocusHdl( LINK( this, ScCondFormatDlg
, RangeLoseFocusHdl
) );
468 mpEdRange
->SetText(aRangeString
);
471 ScCondFormatDlg::~ScCondFormatDlg()
476 void ScCondFormatDlg::dispose()
485 mpCondFormList
.clear();
488 ScAnyRefDlg::dispose();
491 void ScCondFormatDlg::SetActive()
494 mpLastEdit
->GrabFocus();
496 mpEdRange
->GrabFocus();
501 void ScCondFormatDlg::RefInputDone( bool bForced
)
503 ScAnyRefDlg::RefInputDone(bForced
);
506 bool ScCondFormatDlg::IsTableLocked() const
508 if (mpLastEdit
&& mpLastEdit
!= mpEdRange
)
514 bool ScCondFormatDlg::IsRefInputMode() const
516 return mpEdRange
->IsEnabled();
519 #define ABS_SREF SCA_VALID \
520 | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE
521 #define ABS_DREF ABS_SREF \
522 | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE | SCA_TAB2_ABSOLUTE
523 #define ABS_DREF3D ABS_DREF | SCA_TAB_3D
525 void ScCondFormatDlg::SetReference(const ScRange
& rRef
, ScDocument
*)
527 formula::RefEdit
* pEdit
= mpLastEdit
;
531 if( pEdit
->IsEnabled() )
533 if(rRef
.aStart
!= rRef
.aEnd
)
534 RefInputStart(pEdit
);
537 if (mpLastEdit
&& mpLastEdit
!= mpEdRange
)
542 OUString
aRefStr(rRef
.Format(n
, mpViewData
->GetDocument(),
543 ScAddress::Details(mpViewData
->GetDocument()->GetAddressConvention(), 0, 0)));
544 pEdit
->SetRefString( aRefStr
);
548 ScConditionalFormat
* ScCondFormatDlg::GetConditionalFormat() const
550 OUString aRangeStr
= mpEdRange
->GetText();
551 if(aRangeStr
.isEmpty())
555 sal_uInt16 nFlags
= aRange
.Parse(aRangeStr
, mpViewData
->GetDocument(),
556 SCA_VALID
, mpViewData
->GetDocument()->GetAddressConvention(), maPos
.Tab());
557 ScConditionalFormat
* pFormat
= mpCondFormList
->GetConditionalFormat();
559 if(nFlags
& SCA_VALID
&& !aRange
.empty() && pFormat
)
560 pFormat
->SetRange(aRange
);
570 void ScCondFormatDlg::InvalidateRefData()
575 // -------------------------------------------------------------
576 // Close the Conditional Format Dialog
578 bool ScCondFormatDlg::Close()
580 return DoClose( ScCondFormatDlgWrapper::GetChildWindowId() );
583 // ------------------------------------------------------------------------
584 // Occurs when the Conditional Format Dialog the OK button is pressed.
586 void ScCondFormatDlg::OkPressed()
588 ScConditionalFormat
* pFormat
= GetConditionalFormat();
591 mpViewData
->GetDocShell()->GetDocFunc().ReplaceConditionalFormat(maKey
,
592 pFormat
, maPos
.Tab(), pFormat
->GetRange());
594 mpViewData
->GetDocShell()->GetDocFunc().ReplaceConditionalFormat(maKey
,
595 NULL
, maPos
.Tab(), ScRangeList());
599 SetDispatcherLock( false );
600 // Queue message to open Conditional Format Manager Dialog
601 GetBindings().GetDispatcher()->Execute( SID_OPENDLG_CONDFRMT_MANAGER
,
602 SfxCallMode::ASYNCHRON
);
607 // ------------------------------------------------------------------------
608 // Occurs when the Conditional Format Dialog is cancelled.
610 void ScCondFormatDlg::CancelPressed()
614 SetDispatcherLock( false );
615 // Queue message to open Conditional Format Manager Dialog
616 GetBindings().GetDispatcher()->Execute( SID_OPENDLG_CONDFRMT_MANAGER
,
617 SfxCallMode::ASYNCHRON
);
622 // ------------------------------------------------------------------------------
623 // Parse xml string parameters used to initialize the Conditional Format Dialog
624 // when it is created.
626 bool ScCondFormatDlg::ParseXmlString(const OUString
& sXMLString
,
631 bool bRetVal
= false;
635 xmlNodePtr pXmlRoot
= NULL
;
636 xmlNodePtr pXmlNode
= NULL
;
638 OString sOString
= OUStringToOString( sXMLString
, RTL_TEXTENCODING_UTF8
);
639 xmlDocPtr pXmlDoc
= xmlParseMemory(sOString
.getStr(), sOString
.getLength());
644 pXmlRoot
= xmlDocGetRootElement( pXmlDoc
);
645 pXmlNode
= pXmlRoot
->children
;
647 while (pXmlNode
!= NULL
&& bRetVal
)
649 sTagName
= OUStringToOString(OUString("Index"), RTL_TEXTENCODING_UTF8
);
650 if (xmlStrcmp(pXmlNode
->name
, reinterpret_cast<xmlChar
const *>(sTagName
.getStr())) == 0)
652 if (pXmlNode
->children
!= NULL
&& pXmlNode
->children
->type
== XML_TEXT_NODE
)
654 sTagValue
= OUString(reinterpret_cast<char*>(pXmlNode
->children
->content
),
655 strlen(reinterpret_cast<char*>(pXmlNode
->children
->content
)),
656 RTL_TEXTENCODING_UTF8
);
657 nIndex
= sTagValue
.toUInt32();
658 pXmlNode
= pXmlNode
->next
;
663 sTagName
= OUStringToOString(OUString("Type"), RTL_TEXTENCODING_UTF8
);
664 if (xmlStrcmp(pXmlNode
->name
, reinterpret_cast<xmlChar
const *>(sTagName
.getStr())) == 0)
666 if (pXmlNode
->children
!= NULL
&& pXmlNode
->children
->type
== XML_TEXT_NODE
)
668 sTagValue
= OUString(reinterpret_cast<char*>(pXmlNode
->children
->content
),
669 strlen(reinterpret_cast<char*>(pXmlNode
->children
->content
)),
670 RTL_TEXTENCODING_UTF8
);
671 nType
= sTagValue
.toUInt32();
672 pXmlNode
= pXmlNode
->next
;
677 sTagName
= OUStringToOString(OUString("Managed"), RTL_TEXTENCODING_UTF8
);
678 if (xmlStrcmp(pXmlNode
->name
, reinterpret_cast<xmlChar
const *>(sTagName
.getStr())) == 0)
680 if (pXmlNode
->children
!= NULL
&& pXmlNode
->children
->type
== XML_TEXT_NODE
)
682 sTagValue
= OUString(reinterpret_cast<char*>(pXmlNode
->children
->content
),
683 strlen(reinterpret_cast<char*>(pXmlNode
->children
->content
)),
684 RTL_TEXTENCODING_UTF8
);
685 bManaged
= sTagValue
.toBoolean();
686 pXmlNode
= pXmlNode
->next
;
698 // ---------------------------------------------------------------------------------------
699 // Generate xml string parameters used to initialize the Conditional Format Dialog
700 // when it is created.
702 OUString
ScCondFormatDlg::GenerateXmlString(sal_uInt32 nIndex
, sal_uInt8 nType
, bool bManaged
)
710 xmlNodePtr pXmlRoot
= NULL
;
711 xmlNodePtr pXmlNode
= NULL
;
713 xmlChar
* pBuffer
= NULL
;
714 const xmlChar
* pTagName
= NULL
;
715 const xmlChar
* pTagValue
= NULL
;
717 xmlDocPtr pXmlDoc
= xmlNewDoc(reinterpret_cast<const xmlChar
*>("1.0"));
719 sTagName
= OUStringToOString(OUString("ScCondFormatDlg"), RTL_TEXTENCODING_UTF8
);
720 pTagName
= reinterpret_cast<const xmlChar
*>(sTagName
.getStr());
721 pXmlRoot
= xmlNewDocNode(pXmlDoc
, NULL
, pTagName
, NULL
);
723 xmlDocSetRootElement(pXmlDoc
, pXmlRoot
);
725 sTagName
= OUStringToOString(OUString("Index"), RTL_TEXTENCODING_UTF8
);
726 sTagValue
= OUStringToOString(OUString::number(nIndex
), RTL_TEXTENCODING_UTF8
);
727 pTagName
= reinterpret_cast<const xmlChar
*>(sTagName
.getStr());
728 pTagValue
= reinterpret_cast<const xmlChar
*>(sTagValue
.getStr());
729 pXmlNode
= xmlNewDocNode(pXmlDoc
, NULL
, pTagName
, pTagValue
);
731 xmlAddChild(pXmlRoot
, pXmlNode
);
733 sTagName
= OUStringToOString(OUString("Type"), RTL_TEXTENCODING_UTF8
);
734 sTagValue
= OUStringToOString(OUString::number(nType
), RTL_TEXTENCODING_UTF8
);
735 pTagName
= reinterpret_cast<const xmlChar
*>(sTagName
.getStr());
736 pTagValue
= reinterpret_cast<const xmlChar
*>(sTagValue
.getStr());
737 pXmlNode
= xmlNewDocNode(pXmlDoc
, NULL
, pTagName
, pTagValue
);
739 xmlAddChild(pXmlRoot
, pXmlNode
);
741 sTagName
= OUStringToOString(OUString("Managed"), RTL_TEXTENCODING_UTF8
);
742 sTagValue
= OUStringToOString(OUString::boolean(bManaged
), RTL_TEXTENCODING_UTF8
);
743 pTagName
= reinterpret_cast<const xmlChar
*>(sTagName
.getStr());
744 pTagValue
= reinterpret_cast<const xmlChar
*>(sTagValue
.getStr());
745 pXmlNode
= xmlNewDocNode(pXmlDoc
, NULL
, pTagName
, pTagValue
);
747 xmlAddChild(pXmlRoot
, pXmlNode
);
749 xmlDocDumpMemory(pXmlDoc
, &pBuffer
, (int*)&nSize
);
751 sReturn
= OUString(reinterpret_cast<char const *>(pBuffer
), nSize
, RTL_TEXTENCODING_UTF8
);
760 IMPL_LINK( ScCondFormatDlg
, EdRangeModifyHdl
, Edit
*, pEdit
)
762 OUString aRangeStr
= pEdit
->GetText();
764 sal_uInt16 nFlags
= aRange
.Parse(aRangeStr
, mpViewData
->GetDocument(),
765 SCA_VALID
, mpViewData
->GetDocument()->GetAddressConvention());
766 if(nFlags
& SCA_VALID
)
767 pEdit
->SetControlBackground(GetSettings().GetStyleSettings().GetWindowColor());
769 pEdit
->SetControlBackground(COL_LIGHTRED
);
773 IMPL_LINK( ScCondFormatDlg
, RangeGetFocusHdl
, formula::RefEdit
*, pEdit
)
779 IMPL_STATIC_LINK_NOARG( ScCondFormatDlg
, RangeLoseFocusHdl
)
785 // ------------------------------------------------------
786 // Conditional Format Dialog button click event handler.
788 IMPL_LINK( ScCondFormatDlg
, BtnPressedHdl
, Button
*, pBtn
)
792 else if (pBtn
== mpBtnCancel
)
797 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */