Kaydet (Commit) 633872e9 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

more for conditional format dialog

Change-Id: Id99be4e98ae1cd57077ac6f3758ebdb9cfc5424c
üst f76aa663
......@@ -1234,8 +1234,9 @@
#define RID_SCDLG_SORTKEY (SC_DIALOGS_START + 157)
#define RID_SCDLG_COLORSCALE (SC_DIALOGS_START + 158)
#define RID_SCDLG_DATABAR (SC_DIALOGS_START + 159)
#define RID_COND_ENTRY (SC_DIALOGS_START + 160)
#define SC_DIALOGS_END (SC_DIALOGS_START + 160)
#define SC_DIALOGS_END (SC_DIALOGS_START + 161)
#ifndef STD_MASKCOLOR
#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
......
......@@ -29,6 +29,8 @@
#include "condformatdlg.hxx"
#include "condformatdlg.hrc"
#include <vcl/vclevent.hxx>
#include "anyrefdg.hxx"
#include "document.hxx"
#include "conditio.hxx"
......@@ -36,8 +38,9 @@
#include <iostream>
ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent):
Control(pParent, ScResId( CTRL_ENTRY ) ),
Control(pParent, ScResId( RID_COND_ENTRY ) ),
mbActive(false),
meType(CONDITION),
maLbType( this, ScResId( LB_TYPE ) ),
maFtCondNr( this, ScResId( FT_COND_NR ) ),
maFtCondition( this, ScResId( FT_CONDITION ) ),
......@@ -54,19 +57,13 @@ ScCondFrmtEntry::ScCondFrmtEntry(Window* pParent):
SwitchToType(COLLAPSED);
FreeResource();
maClickHdl = LINK( pParent, ScCondFormatList, EntrySelectHdl );
maLbType.SelectEntryPos(1);
maLbCondType.SelectEntryPos(0);
maEdVal2.Hide();
}
long ScCondFrmtEntry::GetHeight() const
{
if(mbActive)
return 100;
else
return 10;
}
namespace {
rtl::OUString getTextForType(ScCondFormatEntryType eType)
......@@ -83,21 +80,54 @@ rtl::OUString getTextForType(ScCondFormatEntryType eType)
break;
}
return rtl::OUString("");
}
rtl::OUString getExpression(sal_Int32 nIndex)
{
switch(nIndex)
{
case 0:
return rtl::OUString("=");
case 1:
return rtl::OUString("<");
case 2:
return rtl::OUString(">");
case 5:
return rtl::OUString("!=");
default:
return rtl::OUString("not yet supported");
}
return rtl::OUString();
}
}
long ScCondFrmtEntry::Notify( NotifyEvent& rNEvt )
{
if( rNEvt.GetType() == EVENT_MOUSEBUTTONDOWN )
{
std::cout << "ButtonDown " << std::endl;
ImplCallEventListenersAndHandler( VCLEVENT_WINDOW_MOUSEBUTTONDOWN, maClickHdl, this );
}
Control::Notify(rNEvt);
}
void ScCondFrmtEntry::SwitchToType( ScCondFormatEntryType eType )
{
switch(eType)
{
case COLLAPSED:
maLbType.Hide();
maFtCondition.SetText(getTextForType(meType));
maFtCondition.Show();
maEdVal2.Hide();
maEdVal1.Hide();
{
maLbType.Hide();
rtl::OUStringBuffer maCondText(getTextForType(meType));
maCondText.append(rtl::OUString(" "));
maCondText.append(getExpression(maLbCondType.GetSelectEntryPos()));
maFtCondition.SetText(maCondText.makeStringAndClear());
maFtCondition.Show();
maEdVal2.Hide();
maEdVal1.Hide();
}
break;
default:
maLbType.Show();
......@@ -111,36 +141,33 @@ void ScCondFrmtEntry::SwitchToType( ScCondFormatEntryType eType )
void ScCondFrmtEntry::Select()
{
mbActive = !mbActive;
Size aSize = GetSizePixel();
aSize.Height() = 130;
SetSizePixel(aSize);
SetControlBackground(Color(COL_RED));
SwitchToType(meType);
}
if(mbActive)
{
Size aSize = GetSizePixel();
aSize.Height() += 120;
SetSizePixel(aSize);
SetControlBackground(Color(COL_RED));
SwitchToType(meType);
}
else
{
Size aSize = GetSizePixel();
aSize.Height() = 60;
SetSizePixel(aSize);
SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
SwitchToType(COLLAPSED);
}
void ScCondFrmtEntry::Deselect()
{
Size aSize = GetSizePixel();
aSize.Height() = 40;
SetSizePixel(aSize);
SetControlBackground(GetSettings().GetStyleSettings().GetDialogColor());
SwitchToType(COLLAPSED);
}
ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId):
Control(pParent, rResId),
mbHasScrollBar(false),
mpScrollBar(NULL),
mpScrollBar(new ScrollBar(this, WB_VERT )),
mnTopIndex(0)
{
mpScrollBar->SetScrollHdl( LINK( this, ScCondFormatList, ScrollHdl ) );
mpScrollBar->EnableDrag();
maEntries.push_back( new ScCondFrmtEntry(this) );
maEntries.push_back( new ScCondFrmtEntry(this) );
maEntries.push_back( new ScCondFrmtEntry(this) );
maEntries[1].Select();
RecalcAll();
FreeResource();
......@@ -148,10 +175,43 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId):
void ScCondFormatList::RecalcAll()
{
sal_Int32 nTotalHeight = 0;
for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
{
nTotalHeight += itr->GetSizePixel().Height();
}
Size aCtrlSize = GetOutputSize();
long nSrcBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
if(nTotalHeight > GetSizePixel().Height())
{
mbHasScrollBar = true;
mpScrollBar->SetPosSizePixel(Point(aCtrlSize.Width() -nSrcBarSize, 0),
Size(nSrcBarSize, aCtrlSize.Height()) );
std::cout << "Need ScrollBar" << std::endl;
mpScrollBar->SetRangeMax(nTotalHeight);
mpScrollBar->SetVisibleSize(aCtrlSize.Height());
mpScrollBar->Show();
}
else
{
std::cout << "Don't need ScrollBar" << std::endl;
mbHasScrollBar = false;
mpScrollBar->Hide();
}
Point aPoint(0,0);
for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
{
itr->SetPosPixel(aPoint);
Size aSize = itr->GetSizePixel();
if(mbHasScrollBar)
aSize.Width() = aCtrlSize.Width() - nSrcBarSize;
else
aSize.Width() = aCtrlSize.Width();
itr->SetSizePixel(aSize);
aPoint.Y() += itr->GetSizePixel().Height();
}
}
......@@ -183,6 +243,22 @@ IMPL_LINK_NOARG( ScCondFormatList, AddBtnHdl )
return 0;
}
IMPL_LINK( ScCondFormatList, EntrySelectHdl, ScCondFrmtEntry*, pEntry )
{
for(EntryContainer::iterator itr = maEntries.begin(); itr != maEntries.end(); ++itr)
{
itr->Deselect();
}
pEntry->Select();
RecalcAll();
return 0;
}
IMPL_LINK_NOARG( ScCondFormatList, ScrollHdl )
{
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -35,7 +35,6 @@
#define BTN_REMOVE 11
#define CTRL_LIST 12
#define CTRL_ENTRY 13
#define LB_TYPE 14
#define FT_COND_NR 15
......
......@@ -36,6 +36,7 @@
#include "rangelst.hxx"
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/scoped_ptr.hpp>
class ScDocument;
class ScConditionalFormat;
......@@ -54,6 +55,8 @@ private:
bool mbActive;
ScCondFormatEntryType meType;
Link maClickHdl;
//general ui elements
ListBox maLbType;
FixedText maFtCondNr;
......@@ -75,8 +78,10 @@ private:
public:
ScCondFrmtEntry( Window* pParent );
long GetHeight() const;
virtual long Notify( NotifyEvent& rNEvt );
void Select();
void Deselect();
};
class ScCondFormatList : public Control
......@@ -86,7 +91,7 @@ private:
EntryContainer maEntries;
bool mbHasScrollBar;
ScrollBar* mpScrollBar;
boost::scoped_ptr<ScrollBar> mpScrollBar;
long mnTopIndex;
void RecalcAll();
......@@ -94,6 +99,8 @@ public:
ScCondFormatList( Window* pParent, const ResId& rResId );
DECL_LINK( AddBtnHdl, void* );
DECL_LINK( ScrollHdl, void* );
DECL_LINK( EntrySelectHdl, ScCondFrmtEntry* );
};
......
......@@ -67,85 +67,86 @@ ModalDialog RID_SCDLG_CONDFORMAT
Pos = MAP_APPFONT( 5, 20 );
Size = MAP_APPFONT( 190, 120 );
Control CTRL_ENTRY
{
Pos = MAP_APPFONT( 0, 0 );
Size = MAP_APPFONT( 190, 40 );
Border = TRUE;
};
};
FixedText FT_COND_NR
{
Pos = MAP_APPFONT( 2, 2 );
Size = MAP_APPFONT( 30, 10 );
Text [ en-US ] = "Condition";
};
Control RID_COND_ENTRY
{
Pos = MAP_APPFONT( 0, 0 );
Size = MAP_APPFONT( 190, 40 );
Border = TRUE;
FixedText FT_CONDITION
{
Pos = MAP_APPFONT( 40, 2 );
Size = MAP_APPFONT( 30, 10 );
};
FixedText FT_COND_NR
{
Pos = MAP_APPFONT( 2, 2 );
Size = MAP_APPFONT( 30, 10 );
Text [ en-US ] = "Condition";
};
ListBox LB_TYPE
{
Pos = MAP_APPFONT( 5, 15 );
Size = MAP_APPFONT( 40, 14 );
Border = TRUE;
DropDown = TRUE;
StringList [ en-US ] =
{
"All Cells";
"Cell value is";
"Formula is";
};
};
ListBox LB_CELLIS_TYPE
{
Pos = MAP_APPFONT( 50, 15 );
Size = MAP_APPFONT( 30, 14 );
Border = TRUE;
DropDown = TRUE;
StringList [ en-US ] =
{
"equal to";
"less than";
"greater than";
"less than or equal to";
"greater than or equal to";
"not equal to";
"between";
"not between";
};
};
FixedText FT_STYLE
{
Pos = MAP_APPFONT( 10, 32 );
Size = MAP_APPFONT( 35, 14 );
Text [ en-US ] = "Apply Style";
};
Edit ED_VAL1
{
Pos = MAP_APPFONT( 90, 15 );
Size = MAP_APPFONT( 70, 14 );
Border = TRUE;
};
Edit ED_VAL2
{
Pos = MAP_APPFONT( 130, 15 );
Size = MAP_APPFONT( 30, 14 );
Border = TRUE;
};
ListBox LB_STYLE
{
Pos = MAP_APPFONT( 50, 32 );
Size = MAP_APPFONT( 30, 14 );
Border = TRUE;
DropDown = TRUE;
StringList [ en-US ] =
{
"New Style...";
};
};
FixedText FT_CONDITION
{
Pos = MAP_APPFONT( 40, 2 );
Size = MAP_APPFONT( 90, 10 );
};
ListBox LB_TYPE
{
Pos = MAP_APPFONT( 5, 15 );
Size = MAP_APPFONT( 40, 14 );
Border = TRUE;
DropDown = TRUE;
StringList [ en-US ] =
{
"All Cells";
"Cell value is";
"Formula is";
};
};
ListBox LB_CELLIS_TYPE
{
Pos = MAP_APPFONT( 50, 15 );
Size = MAP_APPFONT( 30, 14 );
Border = TRUE;
DropDown = TRUE;
StringList [ en-US ] =
{
"equal to";
"less than";
"greater than";
"less than or equal to";
"greater than or equal to";
"not equal to";
"between";
"not between";
};
};
FixedText FT_STYLE
{
Pos = MAP_APPFONT( 10, 32 );
Size = MAP_APPFONT( 35, 14 );
Text [ en-US ] = "Apply Style";
};
Edit ED_VAL1
{
Pos = MAP_APPFONT( 90, 15 );
Size = MAP_APPFONT( 70, 14 );
Border = TRUE;
};
Edit ED_VAL2
{
Pos = MAP_APPFONT( 130, 15 );
Size = MAP_APPFONT( 30, 14 );
Border = TRUE;
};
ListBox LB_STYLE
{
Pos = MAP_APPFONT( 50, 32 );
Size = MAP_APPFONT( 30, 14 );
Border = TRUE;
DropDown = TRUE;
StringList [ en-US ] =
{
"New Style...";
};
};
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment