The drives or partitions seen according to Gparted is as in attached schreenshot.
Now if i format and resize sda4 partition with Gparted will it affect my win7 working?
No. It will not affect the contents of sda1,2 & 3. At least as far as my experience. But it is always sound to back up everything first before doing any partitioning action.
However, the empty space freed after reduction of sda4 becomes unusable. Since sda4 is currently declared as a stand alone Primary partition you wouldn't be able to create sda5 or another primary next to it; you have need first to declare to Create a Logical partition WITHIN 4th Primary partition. Technically sda4 (4th partition) declares the volume of the Extended partition which shall house the logical partitions; e.g. one disk sliced into 8 partitions consecutively shall default to labels sda1, sda2, sda3, sda5, sda6, sda7, sda8 (number 4 is hidden) but contains partitions 5,6,7,8.
1. Data content in sda4 is only 17.15 Gib, you should back this up into an external disk or burned into 4-5 pieces of 4.7Gib DVD, you should take no action against sda4 until this backup concern is well addressed to.
2. After backup is done and confirmed launch Gparted again. Right click sda4 partition choose Create Logical Partition, formatted to Linux Swap, size=1.5Gib (or at your choice -/+ ) click Apply (NOTE: this will now destroy all existing data on sda4, but since you have already backed up fully there is nothing to worry --you may restore the contents at your time.) It should appear as sda5.
3. Repeat No. 2 procedure to the remaining space, formatted to ext4, size = 20 Gib, click Apply, this should be sda6;
4. Repeat same procedure to the rest of space formatted to ext3 or ext4, you will need these to restore your backed up data.
5. Partition sda6 (size 20 Gib) above, should be enough for any distro to install on fully.
BTW, while at Gparted LiveCD get a terminal and back up your MBR into a usb or by mounting your win7 partition and writing a copy of mbr on it; the back up file is only a very small file of 512 Bytes which can be kept even into a floppy if you have:
~# mkdir /mnt/winspace
~# mount -t vfat /dev/sda3 /mnt/winspace
~# cd /mnt/winspace
Now being there, /dev/sda3 <you have no plans of altering anything on it> , do the MBR back up:
~# dd if=/dev/sda of=myold.mbr bs=512 count=1
Check if back up is ok:
~# file myold.mbr
<should return something like this...>
myold.mbr: x86 boot sector, LInux i386 boot LOader;
partition 1: ID=0x83, starthead 32, startsector 2048,
52746240 sectors; partition 2: ID=0x83, starthead 254,
startsector 52748288, 40960000 sectors; partition 3:
ID=0x83, starthead 254, startsector 93708288, 40960000
sectors; partition 4: ID=0x5, starthead 254,
startsector 134668288, 842104832 sectors, code offset 0x63
If need to restore the MBR arises just write it back by going into the folder where 'myold.mbr is located and issue command:
~# dd if=myold.mbr of=/dev/sda
If you have further questions feel free to ask.
Hope that helps.